import {combineReducers}        from 'redux';

import {RESET_ERROR_MESSAGE}    from '../constants';

import cart                     from './cart';
import store                    from './store';
import active                   from './active';
import common                   from './common';
import voucher                  from './voucher';

// const errorMessage = (state = null, {type, error}) => type === RESET_ERROR_MESSAGE ? null : (error ? error : state);
const errorMessage = (state = null, action) => {
    var {type, error} = action;
    return type === RESET_ERROR_MESSAGE ? null : (error ? error : state);
};


export default combineReducers({
    cart,
    store,
    active,
    common,
    voucher,
    errorMessage,
});
